package com.ssy.lingxi.report.dao.contract;

import com.ssy.lingxi.report.api.enums.CommonBooleanEnum;
import com.ssy.lingxi.report.model.bo.tally.statistics.ContractManageStatisticsTallyVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 *  合同管理DAO
 * @author ds
 * @date 2021/5/11
 * @version 2.0.0
 */
@Service
public class ConPurchaseInviteBidDAO {

    @Resource
    @Qualifier("contractJdbcTemplate")
    private JdbcTemplate jdbcTemplate;

    /**
     * 查询待创建采购-招标合同统计数量
     * @return
     */
    public List<ContractManageStatisticsTallyVO> getStatisticsCount() {
        StringBuilder sql = new StringBuilder();
        sql.append(" select ")
                .append(" invite_bid_member_id memberId,invite_bid_role_id roleId,")
                .append(" count(id) toBeCreateInviteTenderCount")
                .append(" FROM con_purchase_invite_bid ")
                .append(" WHERE is_create= "+ CommonBooleanEnum.NO.getCode())
                .append(" group by invite_bid_member_id,invite_bid_role_id;");
        return jdbcTemplate.query(sql.toString(), new BeanPropertyRowMapper<>(ContractManageStatisticsTallyVO.class));
    }

}
